package 集合框架;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;

    public class Days {
        public static void main(String[] args) {
            ArrayList<Long> arrayList = new ArrayList<>();
            String[] strs = new String[5];
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入五个出生日期，以-分隔，如2020-03-25");
            for(int i = 0; i < 5; i++) {
                try {
                    strs[i] = sc.nextLine();
                    //获取当前时间得毫秒数
                    Long nowtimes = System.currentTimeMillis();
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                    Date date = sdf.parse(strs[i]);
                    Long oldtime = date.getTime();
                    long day = (nowtimes - oldtime)/1000/60/60/24;
                    arrayList.add(day);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
            for(int i = 0; i < 5;i++) {
                System.out.println(arrayList.get(i));
            }

        }
    }

